﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;

namespace IFServerDLL.Model
{
    [DataContract]
    public class TradeBase
    {
        public TradeBase()
        {

        }
        public TradeBase(OrderBase ord, int tradeVolume)
        {
            Instrument = ord.Instrument;
            BuyOrSell = ord.BuyOrSell;
            Price = ord.Price;
            TodayVolume = tradeVolume;
            Cash =GlobalStatic.GetCash(Instrument,tradeVolume,ord.Price);
            Commission = GlobalStatic.GetCommiss(Instrument, tradeVolume, ord.Price); 
            YesterdayVolume = 0;
            TradeTime = ord.LastTradeTime.Value;
            OrderID = ord.OrdID;
            OrdSeqNo = ord.SeqNo;
        }
        
        [DataMember]
        public Guid OrderID { get; set; }
        [DataMember]
        public int OrdSeqNo { get; set; }
        [DataMember]
        public string Instrument { get; set; }
        [DataMember]
        public MyEnumDirection BuyOrSell { get; set; }
        [DataMember]
        public decimal Price { get; set; }
        [DataMember]
        public int TodayVolume { get; set; }
        [DataMember]
        public DateTime TradeTime { get; set; }
        [DataMember]
        public decimal Cash { get; set; }
        [DataMember]
        public decimal Commission { get; set; }
        [DataMember]
        public decimal OnHandProfit { get; set; }
        [DataMember]
        public int YesterdayVolume { get; set; }

        public int ALLVolumne { get { return TodayVolume + YesterdayVolume; } }
    }
}
